package cn.ss.exam2302.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

// 后端发给前端的JSON统一数学模型
@NoArgsConstructor
@AllArgsConstructor
@Data
public class JsonResult {
    public static final int FAIL = 0;
    public static final int SUCCESS = 1;

    private int status; // 自定义状态码
    private String message; // 状态描述
    private Object data; // 数据

    public static final JsonResult JSONRESULT_FAIL = new JsonResult(FAIL);
    public static final JsonResult JSONRESULT_SUCCESS = new JsonResult(SUCCESS);

    public JsonResult(int status) {
        this.status = status;
    }

    public JsonResult(int status, String message) {
        this.status = status;
        this.message = message;
    }
}
